<%@page import="com.polytech.model.Topic"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <meta charset="utf-8">
    <title>
       List des discussions
    </title>
 
    <link href="/irm-forum/views/css/css.css" rel="stylesheet">
    <link href="/irm-forum/views/css/main.css" rel="stylesheet">
	<link href="/irm-forum/views/css/table.css" rel="stylesheet">
  </head>
  <body>
	<jsp:include page="layout/header.jsp"/>
    <div class="wrapper">
      <div class="content" style="position: relative;">
      	 <%if(session.getAttribute("login")!=null){%>
     	 <div align="right">
     	 	<a href="/irm-forum/forum/new-topic.action" class="button add">Nouveau Topic</a>
     	 </div>
     	 <%}else{%>
     	 	<div align="right">
     	 		<p> <a href="/irm-forum/profile/login.action"> Connectez vous pour publier vos questions </a> </p>
     	 	</div>
     	 <% }%>
     	<% List<Topic>listTopics=(List<Topic>)request.getAttribute("listTopics");
     	   if(listTopics!=null)
     	   for(Topic topic:listTopics){
     	%>
        <table style="margin-bottom: 2px;">
          <thead>
            <tr>
              <th colspan="2" style="text-align: left;position:relative; height:20px;">
              	 <span style="position: relative;left: 0px;">Sujet: <%=topic.getSubject()%></span>
              	 <span style="position: relative;left:30%">poster le <%=topic.getPublicationDate() %> par <%=topic.getCreator().getLogin() %> </span>
              	 <a href="/irm-forum/forum/show-topic.action?id=<%=topic.getId()%>" style="position:absolute;right:0px;padding-right:5px;text-decoration: underline;color: white;"> voir les posts</a>
              </th>
            </tr>
          </thead>
    	  <tbody>
     	    <tr class="alt">
      		  <td colspan="2" style="height: 50px;padding: 5p;overflow: auto;"><div> <%=topic.getText()%> </div> </td>
      		</tr>
    	  </tbody>
  		</table>
  	    <%} %>
      </div>
    </div>
   <jsp:include page="/views/layout/footer.jsp"></jsp:include>
       
</body></html>